<template>
  <div
    class="music-playing-effect"
    :style="{ transform: `scale(${scale[0]}, ${scale[1]})` }"
  >
    <span :style="{ backgroundColor: color }"></span>
    <span :style="{ backgroundColor: color }"></span>
    <span :style="{ backgroundColor: color }"></span>
    <span :style="{ backgroundColor: color }"></span>
  </div>
</template>

<script>
export default {
  name: "MusicPlayingEffect",
  props: {
    scale: {
      type: Array,
      default: () => [1, 1]
    },
    color: {
      type: String,
      default: () => "#fe0b5b"
    }
  }
};
</script>

<style scoped lang="less">
@keyframes music-play {
  0% {
    height: 50%;
  }
  50% {
    height: 100%;
  }
  100% {
    height: 50%;
  }
}
.music-playing-effect {
  width: 7vw;
  height: 7vw;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  span {
    width: 20%;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    background-color: #fe0b5b;
  }
  span:nth-child(1) {
    animation: music-play 0.8s linear infinite;
    animation-delay: 0s;
  }
  span:nth-child(2) {
    animation: music-play 0.8s linear infinite;
    animation-delay: 0.2s;
  }
  span:nth-child(3) {
    animation: music-play 0.8s linear infinite;
    animation-delay: 0.3s;
  }
  span:nth-child(4) {
    animation: music-play 0.8s linear infinite;
    animation-delay: 0.4s;
  }
}
</style>
